<html>
  <head>
    <title>Map Test</title>
  </head>
  <body>
    <!--<div id="mapsearch">
      <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span>
    </div>-->
    <div id="map" style="width: 320px; height: 274px"></div>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAtyszdolYTn9pK5seMWq8shRDiIO9i7IdI7xQHaHlQYSVzooxUBQIWChgh9j1TDNMnC-JS6HKJHbbMw" type="text/javascript"></script>
    <style type="text/css">
      @import url("http://www.google.com/uds/css/gsearch.css");
    </style>
  
    <script type="text/javascript">
      window._uds_msw_donotrepair = true;
    </script>
    <script src="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js?mode=new" type="text/javascript"></script>
    <style type="text/css">
      @import url("http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css");
    </style>
    <style type="text/css">
      .gsmsc-mapDiv {
        height : 275px;
      }

      .gsmsc-idleMapDiv {
        height : 275px;
      }

      #mapsearch {
        width : 365px;
        margin: 10px;
        padding: 4px;
      }
    </style>
    <script type="text/javascript">
      var myMapSearchControl;
      if (GBrowserIsCompatible()) { 

        // A function to create the marker and set up the event window
        // Dont try to unroll this function. It has to be here for the function closure
        // Each instance of the function preserves the contends of a different instance
        // of the "marker" and "html" variables which will be needed later when the event triggers.    
        
        function createMarker(point,name,html) {
          var marker = new GMarker(point);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(html);
          });
          return marker;
        }
        
        // Display the map, with some controls and set the initial location 
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        //map.addControl(new GMapTypeControl());
        //map.setCenter(new GLatLng(37.42774034893813, -122.1699857711792),14);
        //set the default center of the map to the coordinates specified here, with zoom factor 9 (0 is maximum distance "away" or "outward" zoom)
        map.setCenter(new GLatLng( 43.907787,-79.359741), 8);
        
        GDownloadUrl("mapinfo.xml", function(doc) {
          var xmlDoc = GXml.parse(doc);
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");

          for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var html = markers[i].getAttribute("html");
            var label = markers[i].getAttribute("label");
            // create the marker
            var marker = createMarker(point,label,html);
            map.addOverlay(marker);
          }
        });
        LoadMapSearchControl();
      } else { // display a warning if the browser was not compatible
        alert("Sorry, the Google Maps API is not compatible with this browser");
      }
    
      function LoadMapSearchControl() {
        var options = {
              zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL,
              title : "Googleplex",
              url : "http://www.google.com/corporate/index.html",
              idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM,
              activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM
              }
        myMapSearchControl = new GSmapSearchControl(
              document.getElementById("map"),
              "1600 Amphitheatre Parkway, Mountain View, CA",
              options
              );
      }
      // arrange for this function to be called during body.onload
      // event processing
      GSearch.setOnLoadCallback(LoadMapSearchControl);
    </script>
    <a href="javascript:myMapSearchControl.execute('Starbucks');">Starbucks</a>
  </body>
</html>
